﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mds.Common
{
    public class ClassConfigurationCache
    {
        private static ClassConfigurationCache _instance = new ClassConfigurationCache();
        public static ClassConfigurationCache Instance
        {
            get
            {
                return _instance;
            }
        }
        /// <summary>
        /// key为接口全名，val为类全名
        /// </summary>
         private Dictionary<string, string> _serviceCaches = new Dictionary<string, string>();
        public int Count
        {
            get
            {
                return _serviceCaches.Count;
            }
        }
        public string GetServiceClass(string interfaceFullName)
        {
            if (_serviceCaches.ContainsKey(interfaceFullName))
                return _serviceCaches[interfaceFullName];
            else
                  return string.Empty;
          
        }
        public void AddService(string interfaceFullName, string serviceClassFullName)
        {
            if (!_serviceCaches.ContainsKey(interfaceFullName))
                _serviceCaches.Add(interfaceFullName, serviceClassFullName);
        }

        internal void Clear()
        {
            _serviceCaches.Clear();
        }
    }
}
